package com.example.updateimages;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@RequestMapping("Update")
public class UpdateController {

    @Autowired
    private UpdateService updateService;

    @PostMapping("add")
    @ResponseBody
    public Boolean add(@RequestBody Update update) {
        Update update1 = new Update();
        update1.setImage(update.getImage());
        return updateService.save(update1);
    }

    @GetMapping("/list")
    public List<Update> list() {
        return updateService.list();
    }
}
